Creating a metafile during scanning
When archiving scans, a metafile is often created for the scan file that contains information required for archiving. The metafile can be created via SMB or FTP during the storage operation. The metafile is created as a plain text file. The structure (xml, CSV...) is arbitrary. Within the file, fixed (structural) text and variables can be mixed.
The variable contents can come from the following areas:

Variable | Example | Description |
---|---|---|
%UserName% | J.Doe | Login name of the user who currently owns the workflow (if the user has multiple logins, the first login in the list is returned). |
%DisplayName% | John Doe | Display name of the user who currently owns the workflow. |
%CardNumber% | EC73810DE667 | Card number that was used to log in to the device (of the user who currently owns the workflow). |
%Email% |
J.Doe@ExampleCompany.com |
E-mail address of the user who currently owns the workflow. |
%ScanFolder% | \Share\Scan\J.Doe | Personal folder of the user who currently owns the workflow. |
%UserTags% | sw1;tag2;KST47 | List of all keywords of the user who currently owns the workflow (separated by semicolons) |
%DepartmentName% | Sales | Name of the department of the user who currently owns the workflow. |
%DepartmentEmail% | Sales@ExampleCompany.com | E-mail address of the department of the user who currently owns the workflow. |
%DepartmentFolder% | \\Share\Scan\Sales | Department folder of the department of the user who currently owns the workflow. |
%CreatorName% | J.Doe | Login name of the user who started the workflow (if the user has multiple logins, the first login in the list is returned). |
%CreatorDisplayName% | John Doe | Display name of the user who started the workflow. |
%CreatorCardNumber% | EC73810DE667 | Card number that was used to log in to the device (of the user who started the workflow). |
%CreatorEmail% |
J.Doe@ExampleCompany.com |
E-mail address of the user who started the workflow. |
%CreatorScanFolder% | \Share\Scan\J.Doe | Personal folder of the user who started the workflow. |
%CreatorTags% | sw1;tag2;KST47 | List of all keywords of the user who started the workflow (separated by semicolons) |
%CreatorDepartmentName% | Sales | Name of the department of the user who started the workflow. |
%CreatorDepartmentEmail% | Sales@ExampleCompany.com | E-mail address of the department of the user who started the workflow. |
%CreatorDepartmentFolder% | \\Share\Scan\Sales | Department folder of the department of the user who started the workflow. |
%UserPermissionChooseDirectPrinter% | true | User right, Select direct printer yourself (true, false). |
%UserPermissionCopyColor% | true | User right to copy in color (true, false). |
%UserPermissionDeviceAdministrator% | false | Device administrator user rights (true, false). |
%UserPermissionOwnAddressbook% | true | User right, Create own address book (true, false). |
%UserPermissionPrintColor% | true | User right, Print in color (true, false). |

Variable | Example | Description |
---|---|---|
%DeviceName% | Lexmark Hallway | Device name or designation. The data record is queried on the device via IPP. |
%DeviceType% | TASKalfa | Device type or name of the device series. The data record is queried on the device via IPP. |
%ModelName% | 2554ci | Model name or model designation. The data record is queried on the device via IPP. |
%Serialnumber% | TES0S81049 | Serial number of the device. The data record is queried on the device via IPP. |

Variable | Example | Description |
---|---|---|
%PrintJobName% | Test page | Print job name |
%PrintJobFileSize% | 1217150 | Print-job size in bytes |
%PrintJobCreated% | 21.12.2020 14:55:59 | Creation date (DD.MM.YYYY hh:mm:ss) |
%AnalyzedPrintPages% | 4 | Analyzed print pages |
%AnalyzedColorMode% | Color | Analyzed color mode (BW/Color) |
%AnalyzedPrintBwPages% | 2 | Number of black/white pages analyzed |
%AnalyzedPrintColPages% | 1 | Number of color pages analyzed |
%AnalyzedDuplexMode% | Long edge | Duplex mode (driver specific e.g. LONGEDGE/SHORTEDGE/OFF) |
%AnalyzedPunchMode% | TwoHoles | Punch (depending on the driver used e.g. NONE/TWOHOLES/FOURHOLES) |
%AnalyzedStapleMode% | True | Staple (depending on the driver used e.g. FALSE/TRUE) |
%AnalyzedFoldMode% | Fold | Fold (depending on the driver used e.g. NOFOLD/FOLD) |

Variable | Example | Description |
---|---|---|
%ScannedPages% | 11 | Number of pages in a scan job |
%ScannedSheets% | 11 | Number of sheets in a scan job |
%OriginalDeviceScanFileSize% | 316184 | Size of the original scanned file in bytes |
%OutputFileSizes% | 22876 | Size of the generated destination file in bytes. If multiple destination files are created from one file due to file separation, a list is output. |
%ScanIdentifier% | 1 | Creates a unique identification number for a scan job (permanently consecutive). This number is generated automatically when the scan job is started (all documents originating from this scan are given the same number – i.e. also individual files created from this scan through document separation). |
%DocNumber% | 1 | Creates a unique number (permanently consecutive) for created documents (also for documents created through document separation). The number is generated in the target module (e.g. The Scan Destination SMB Module). The number is not generated for a USB destination. |
%FilePath% | c:\scan | Full path to the file |
%FileName% | Invoice.pdf | File name with file extension |
%FileExt% | File extension without dot | |
%FileNameNoExt% | Invoice | File name without file extension |

Variable | Example | Description |
---|---|---|
%Date.DD% | 31 or 01 | The day of the date |
%Date.MM% | 12 or 01 | The month of the date |
%Date.YY% | 17 for 2017 or 01 for 2001 | The two-digit year of the date |
%Date.YYYY% | 2017 | The four-digit year of the date |
%Time.hh% | 23 or 01 | The hour of the time |
%Time.mm% | 59 or 01 | The minute of the time |
%Time.ss% | 59 or 01 | The second of the time |
%DateTime% | 20171109154321 for 11/09/2017 15:43:21 | A timestamp from %DATE.YYYY%%DATE.MM%%DATE.DD%%TIME.HH%%TIME.MM%%TIME.SS% |
%DateFormatted% | 11/09/2017 2:55 pm | Date formatted according to the operating system settings. |

User-defined fields can be inserted for devices and users (for users, the contents of these fields can also be imported). The data from these fields are stored in variables named the same as the field name. With the field name Additional Field, the variable call would be %Additional Field% (variable names must be unique).

If a user interview is made in a workflow, i.e. the user enters or selects data on the device, these are stored in freely definable variables and these are defined in the following modules:
For use, the names of the variables must be enclosed with % characters, e.g. %variable name%.

Variables for zone OCR (see also Zone OCR, Barcode, QRCode module) are dependent on the name of the zone. The corresponding destinations are as follows:
- Text variable %OCRZONE.<zone_name>% (e.g. %OCRZONE.zone 1%) for the content of text or barcode zones and
- Table variables %OCRTABLE.<zone_name>.COL<colum_no.>% (e.g. %OCRTABLE.zone 1.COL2%) for the contents of table zones. This variable is automatically repeated in a metafile as many times as rows are detected in the table.

A variety of variables can be created in a document review, see Document review.

When using the document input Folder, you can pass an XML file to a document workflow in addition to an image file, which can be used to pass variables to the workflow. The variables can then be used in the workflow like the variables of a user interview (see also Document processing).
The name of the variable must not contain special characters. Allowed are small and capital letters (no umlauts or similar), numbers and the dot ".".
If the variable name is used in several places, all places can influence the variable value.
The XML file must have the same name as the associated image file (test.tif > test.xml).
<DocumentOptions>
<UserLogin>administrator</UserLogin>
<Variables>
<variable name="Name1" value="value1" type="string"/>
<variable name="Name2" value="222" type="int"/>
</Variables>
</DocumentOptions>
- The main area <DocumentOptions> must be present.
- The <Variables> area contains variable definitions.
- <variable name="Name1" value="value1" type="string"/> defines a variable by the name of Name1 with the content value1 of the type string. A numerical value can also be defined as an int (integer).
The type is of importance for formatting the variable (if it is missing, string is assumed), see also Variables.

Variables that originate from interview modules or from zone OCR can be translated into a different value. This is useful, for example, if a read barcode only contains a number, but a metafile to be generated needs to contain the descriptive text.
The allocation tables for this can be maintained in IQ4docs. It is also possible to query any database via ODBC. Together with the decision module, this can also be used to check variable values for plausibility, for example.
The variable values can be overwritten by the new value or a new variable can be created.
For use, the names of the new variables must be enclosed with % characters, as are all variables, e.g. %variable name%.

The value of a variable can be formatted. This can be useful if, for example, the output of the number of scanned pages in a metafile must always consist of 5 digits (25 > 00025).
The formatting specification is inserted into the % characters enclosing the variable name.
All variables are considered string data types by default. If the converted value is to be reused as a string, no data type specification is required. But if you know that the string variable contains a number, you can make a conversion to int and use formatting for numbers.
Example | Description | Variable value | Result |
---|---|---|---|
%SCANNEDPAGES% | Unchanged variable value | 25 | 25 |
%OCRZONE.ZONE1$(0,5)% | Text right-justified, 5 characters with leading spaces | "Text" | " Text" |
%OCRZONE.ZONE1$(0,-5)% | Text left-justified, 5 characters with spaces following | "Text" | "Text " |
%SCANNEDPAGES$int(0:d5)% | Conversion to numeric value, 5 digits with leading zeros | 25 | 00025 |
%CARDNUMBER$int(0:X)% | Conversion to numerical value, hexadecimal output | 12345678 | BC614E |
Further descriptions of the formatting of types or user-defined number format strings can be found in the Microsoft documentation.
Incorrect formatting of the variables can lead to a processing error.
Proceed as follows to create a scan workflow that creates and populates a metafile.

To open the web administration, enter http://<hostname>/webadmin in the web browser (where hostname corresponds to the server on which IQ4docs WebAdmin was installed).

To use an existing workflow, click on Workflows in the Web Administration menu (the list of existing workflows opens). Click on the desired line. The workflow editor opens. To create a new workflow, click Create Workflow and select an SMB or FTP scanning workflow and give the workflow a name of your choice.

You can create a metafile in the SMB or FTP module. To do so, click Metafile in the setting.

A text-based metafile can be created for the actual destination file. This file is then transferred to the destination location in addition to the destination file (e.g. is stored in the same folder).
Encoding: Set which encoding method should be used to create the text file. The following encoding methods are available (please contact your IQ4docs contact if you require an encoding method that is not currently offered):
- UTF-8
- UTF-8 with BOM
- UTF-16 big endian
- UTF-16 little endian
- UTF-32 big endian
- UTF-32 little endian
- ASCII
- ISO 8859-15
- Windows-1252
Note that not all (special) characters can be displayed correctly with every encoding method. Characters that cannot be displayed may be replaced by other characters.
Metafile name: Specify the name of the metafile with file extension. If no variables are used in the name (e.g. metafile.xml), the file will always be overwritten during transfer via FTP if it already exists. For SMB, an additional number is inserted in the name (e.g. metafile (1).xml). All variables can be used in the name, see Variables.
Metafile content: Use this field to define the content of the metafile. All Variables can be used in the content of the metafile. In connection with this, please also note the possibilities of Zone OCR, see Zone OCR, Barcode, QRCode module.